import {createRouter, createWebHistory} from "vue-router";
import Login from "@/views/Login.vue";
import AdminLayout from "@/views/AdminLayout.vue";
import UserInfo from "@/views/user/UserInfo.vue";
import UserList from "@/views/user/UserList.vue";
import RestPassword from "@/views/user/RestPassword.vue";
import HotelList from "@/views/hotel/Hotel.vue";
import HotelList1 from "@/views/hotel/Hotel1.vue";
import RoomList from "@/views/room/Room.vue";
import RoomList1 from "@/views/room/Room1.vue";
import Register from "@/views/Register.vue";
import OrderList from "@/views/order/OrderList.vue";
import Payment from "@/views/order/Payment.vue";
import Create from "@/views/order/OrderCreate.vue";
import DesignerLayout from "@/views/DesignerLayout.vue";
import UserLayout from "@/views/UserLayout.vue";
import {ElMessage} from "element-plus";
import comments from "@/views/comments/comments.vue";



// 定义路由关系
const routes = [
  {path: '/login', component: Login},
  { path:'/Register', name:'Register', component:Register},
  {path: '/order/payment/:orderId', component: Payment},
  {path: '/order/create', component: Create},// 一级路由
  {
    path: '/admin',
    redirect: '/admin/user/list',  // 重定向
    component: AdminLayout,
    // 子路由
    children: [
      {path: 'user/list', component: UserList},
      {path: 'user/info', component: UserInfo},
      {path: 'user/resetPassword', component: RestPassword},
      {path: 'hotel/list', component: HotelList},
      {path: 'room/list', component: RoomList},
      {path: 'order/list', component: OrderList},
      // {path: 'order/create', component: Create},
      {path: 'comments/list', component: comments}
    ]
  },
  {
    path: '/designer',
    component: DesignerLayout,
    redirect: '/designer/hotel/list',
    children: [
      {path: 'hotel/list', component: HotelList},
      {path: 'room/list', component: RoomList},
      {path: 'user/info', component: UserInfo},
      {path: 'user/resetPassword', component: RestPassword},
      {path: 'order/list', component: OrderList},
      // {path: 'order/payment/:orderId', component: Payment},
      // {path: 'order/create', component: Create},
      {path: 'comments/list', component: comments}
    ]
  },
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/hotel/list',
    children: [
      {path: 'hotel/list', component: HotelList1},
      {path: 'room/list', component: RoomList1},
      // {path: 'order/create', component: Create},
      {path: 'order/list', component: OrderList},
      // {path: 'order/payment/:orderId', component: Payment},
      {path: 'user/info', component: UserInfo},
      {path: 'user/resetPassword', component: RestPassword},
      {path: 'comments/list', component: comments}
    ]
  },
]
const router = createRouter({
  history: createWebHistory(), // 路由模式
  routes: routes
})
//导出暴露
export default router
